package com.yxdj.user.api;

import com.yxdj.common.core.constant.SecurityConstants;
import com.yxdj.common.core.constant.ServiceNameConstants;
import com.yxdj.common.core.domain.R;
import com.yxdj.user.api.domain.User;
import com.yxdj.user.api.factory.RemoteManageUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteManageUserService", value = ServiceNameConstants.USER_SERVICE, fallbackFactory = RemoteManageUserFallbackFactory.class)
public interface RemoteManageUserService {

    /**
     * app用户登录
     * @param phone
     * @return
     */
    @PostMapping("/user/app/login/{phone}")
    R<User> login(@PathVariable(name = "phone") String phone, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * app用户注册
     * @param user
     * @param source
     * @return
     */
    @PostMapping("/user/app/register")
    R<User> register(@RequestBody User user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 根据用户id获取用户信息
     * @param id
     * @param source
     * @return
     */
    @GetMapping("/user/getUserById/{id}")
    R<User> getUserById(@PathVariable(name = "id") Long id,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
